/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * com_distri_folios.java
 *
 * Created on 28/01/2011, 12:18:35 PM
 */

package sie_invdis;

import java.sql.*;
import javax.swing.*;

import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTable.*;
import java.awt.*;
import java.util.Date;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.text.*;
/**
 *
 * @author Michelle
 */
public class com_distri_folios  extends javax.swing.JFrame {

    private javax.swing.table.DefaultTableModel jtable_modelo;
    private JTable jtable_tiendas;
    private int buscamp=1;
    private int control_enter=0,controlcombo=0;
    private SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
    private SimpleDateFormat formateadoresta = new SimpleDateFormat("yyyy-MM-dd");
    //se crea intancia de la clase conexion
    bd_conexion x = new bd_conexion() ;
       //se creaa la variable resultset
    ResultSet rs = null;
    /** Creates new form com_distri_folios */
    public com_distri_folios() {
       // super(parent, modal);
      //establesco la ubicacion de este formulariohijo
     //x.estableceConexion();
     this.setLocation(25,25);
      //se contrulle el modelo de tabla
     this.iniciar_modelo_de_tabla();
     
     initComponents();
      //establecer el tamaño de las columnas
       if(JOptionPane.showConfirmDialog(null, "Desea Ver Recepciones Pendientes?")==0) {
            this.carga_datos(0,"");
        }
     
    jTable1.getColumnModel().getColumn(0).setPreferredWidth(30);//Folio
    jTable1.getColumnModel().getColumn(1).setPreferredWidth(50);//status
    jTable1.getColumnModel().getColumn(2).setPreferredWidth(30);//doc ant.
    jTable1.getColumnModel().getColumn(3).setPreferredWidth(45);//fecha
    jTable1.getColumnModel().getColumn(4).setPreferredWidth(45);//fecha llega tienda
    jTable1.getColumnModel().getColumn(5).setPreferredWidth(45);//f.recepcion
    jTable1.getColumnModel().getColumn(6).setPreferredWidth(40);//Dias Trans.
    jTable1.getColumnModel().getColumn(7).setPreferredWidth(75);//guia
    jTable1.getColumnModel().getColumn(8).setPreferredWidth(70);//Cliente
    jTable1.getColumnModel().getColumn(9).setPreferredWidth(20);//piezas
    jTable1.getColumnModel().getColumn(10).setPreferredWidth(80);//Observaciones

    jTable1.getTableHeader().setBackground(Color.yellow);
    jTable1.requestFocus();
    this.loadcombo();
    this.buttonGroup1.setSelected(jrbtn_doctoanterio.getModel(), true);
    this.jtf_busqueda.requestFocus();
    controlcombo=1;
  }
private void iniciar_modelo_de_tabla()
    {

        jtable_modelo=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo.addColumn("<html><b>Folio</b></html>");
        jtable_modelo.addColumn("<html><b>Status</b></html>");
        jtable_modelo.addColumn("<html><b>Doc. Ant.</b></html>");
        jtable_modelo.addColumn("<html><b>Fecha</b></html>");
        jtable_modelo.addColumn("<html><b>F.llega Tienda</b></html>");
        jtable_modelo.addColumn("<html><b>F.Recepcion</b></html>");
        jtable_modelo.addColumn("<html><b>Dias Trans.</b></html>");
        jtable_modelo.addColumn("<html><b>Guia Env.</b></html>");
        jtable_modelo.addColumn("<html><b>Cliente</b></html>");
        jtable_modelo.addColumn("<html><b>Piezas</b></html>");
        jtable_modelo.addColumn("<html><b>Observaciones</b></html>");
        jtable_modelo.addColumn("<html><b>Docto Sig</b></html>");

   }

    private void loadcombo()
    {
          try
            {
               rs = x.sieuno_executediversosv2("select * from x1distribucion_tiendas_activas(3,'','') as (tie_descri character varying(35),tie_id integer,tie_desesque character varying(25),idclie character varying(12));",variables_global.getconexiongral());
               while (rs.next())
                    {
                          this.jcbx_tiendas.addItem(rs.getString("tie_id")+":"+rs.getString("tie_descri")+":"+rs.getString("idclie"));
                    }
            }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
        try
            {
               rs = x.sieuno_executediversosv2("select * from x1distribucion_tiendas_activas(4,'','') as (tie_descri character varying(35),tie_id integer,tie_desesque character varying(25),idclie character varying(12));",variables_global.getconexiongral());
               while (rs.next())
                    {
                          this.jcbx_tiendas.addItem(rs.getString("tie_id")+":"+rs.getString("tie_descri")+":"+rs.getString("idclie"));
                    }
            }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }
 private void dioclick(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
         System.out.println("dio doble  click");
         int columna =jTable1.getSelectedColumn();
         int fila = jTable1.getSelectedRow();
         System.out.println("dio doble  click Sobre="+columna+"Fila:"+fila+"tamaño:"+jTable1.getValueAt(fila, 7).toString());
         if ((columna==7) && (jTable1.getValueAt(fila, 7).toString().length() == 0))
                    {
                        String jtguia="",retorno="";
                        jtguia=JOptionPane.showInputDialog("Ingresa Numero Guia:");
                        if (jtguia.length() > 0)
                            {
                                Object valorfolio = jTable1.getValueAt(fila, 0);

                                try
                                    {
                                    rs = x.sieuno_executediversosv2("select * from x1distribucion_ventasactualiza('"+String.valueOf(valorfolio)+"','"+jtguia+"',1);",variables_global.getconexiongral());
                                    while (rs.next())
                                            {
                                                retorno=rs.getString(1);
                                            }
                                     }
                                 catch(Exception e)
                                     {
                                            System.out.println(e.getMessage());
                                     }
                                 if (retorno.equals("1"))
                                     {
                                         jTable1.setValueAt(jtguia,fila,7);
                                     }
                            }
                    }
                else
                    {
                        Object valor = jTable1.getValueAt(fila, 0);
                        //JFrame mainFrame = Sie_invdisApp.getApplication().getMainFrame();
                        com_distri_folios_detalle fdd=new com_distri_folios_detalle(String.valueOf(valor));
                        fdd.pack();
                        fdd.setVisible(true);
                    }
        //setVisible(false);
    }
 
private void carga_datos(int opbus,String tbusca)
    {
       String fechacat = "",fechallegatienda="",fechaentrega="";
       DecimalFormat miformat = new DecimalFormat("###,###,###,###");
       String abrehtml="",cierrahtml="";
        while(jtable_modelo.getRowCount()>0)jtable_modelo.removeRow(0);
       //invoco al metodo que trae el recordset de datos
       String texto="select * from x1distribucion_terminados_ventas_catalogov3('"+variables_global.getcliente_tistribucion()+"',"+opbus+",'"+tbusca+"','') as (idreg integer,id character varying(12),idesta smallint,desta character varying(15), claveperdoc character varying(45),dante character varying(12), doctosig character varying(12),fedoc text,feent text,fechavenci date,impuesto1 numeric,impuesto2 numeric,descuentotot numeric,descuentofin numeric,idcliente character varying(12),nomclie character varying(60),obserdoc character varying(80), usuario character varying(20),flete numeric,guia character varying(60), fechaenvio date,idmoneda smallint,descripmoneda character varying(30),idalmacen smallint,describamacen character varying(30),total numeric,tpz numeric,distra integer,clasif smallint,distrans2 integer)";
      System.out.println(texto);
        try
         {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                 switch (rs.getInt("idesta"))
                    {
                        case 1:
                            abrehtml="<html><b><font color=#CC0000>";
                            cierrahtml="<font></b></html>";
                        break;
                        case 4:
                            abrehtml="<html><b><font color=#FF6633>";
                            cierrahtml="<font></b></html>";
                        break;
                        default:
                             abrehtml="<html>";
                            cierrahtml="</html>";
                        break;
                    }
                    if(rs.getString("fechavenci") != null)
                        {
                           fechallegatienda=""+ rs.getString("fechavenci")+"";
                        }
                    if(rs.getString("feent") != null )
                        {
                            fechaentrega=""+rs.getString ("feent")+"";
                        }
                fechacat=""+rs.getString ("fedoc")+"";
                jtable_modelo.addRow(new Object[]{rs.getString ("id"),abrehtml+rs.getString ("idesta")+":"+rs.getString ("desta")+cierrahtml,abrehtml+rs.getString ("dante")+cierrahtml,abrehtml+fechacat+cierrahtml,abrehtml+fechallegatienda+cierrahtml,abrehtml+fechaentrega+cierrahtml,abrehtml+rs.getString ("distra")+cierrahtml,rs.getString ("guia"),abrehtml+rs.getString ("nomclie")+cierrahtml,abrehtml+miformat.format(rs.getFloat("tpz"))+cierrahtml,abrehtml+rs.getString ("obserdoc")+cierrahtml,rs.getString ("doctosig")});
                }

        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
            this.jlbl_cantidadregistros.setText(String.valueOf(this.jtable_modelo.getRowCount()));
            this.jlbl_textobuscado.setText(this.jtf_busqueda.getText().toUpperCase().trim());
            int numerofilas=this.jtable_modelo.getRowCount();
             for(int i = 0 ;i < numerofilas; i++)
                {
                     jTable1.setRowHeight(i, 30);
                }
      }


  

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jbtn_helpayuda = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jbtn_sugerencias = new javax.swing.JButton();
        jbtn_agregar = new javax.swing.JButton();
        jbtn_agregar1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jcbx_tiendas = new javax.swing.JComboBox();
        jtf_busqueda = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jbtn_busqueda = new javax.swing.JButton();
        jrbtn_folio = new javax.swing.JRadioButton();
        jrbtn_doctoanterio = new javax.swing.JRadioButton();
        jrbtn_obserdocto = new javax.swing.JRadioButton();
        jrbtn_cliente = new javax.swing.JRadioButton();
        jbtn_actualizar = new javax.swing.JButton();
        jcbx_filtrarpendientes = new javax.swing.JCheckBox();
        jrbtn_ultimos100 = new javax.swing.JRadioButton();
        jcxb_verultimos = new javax.swing.JCheckBox();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        };
        jLabel4 = new javax.swing.JLabel();
        jlbl_textobuscado = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jlbl_cantidadregistros = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jmni_salir = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jmni_buscar = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jmni_opcionbusqueda = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jmni_actulizar = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        jmni_agregarfolio = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jmni_crearcomentario = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(com_distri_folios.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        jbtn_helpayuda.setIcon(resourceMap.getIcon("jbtn_helpayuda.icon")); // NOI18N
        jbtn_helpayuda.setText(resourceMap.getString("jbtn_helpayuda.text")); // NOI18N
        jbtn_helpayuda.setName("jbtn_helpayuda"); // NOI18N
        jbtn_helpayuda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_helpayudaActionPerformed(evt);
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.setName("jPanel1"); // NOI18N

        jButton1.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N
        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jbtn_sugerencias.setText(resourceMap.getString("jbtn_sugerencias.text")); // NOI18N
        jbtn_sugerencias.setName("jbtn_sugerencias"); // NOI18N
        jbtn_sugerencias.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_sugerenciasActionPerformed(evt);
            }
        });

        jbtn_agregar.setIcon(resourceMap.getIcon("jbtn_agregar.icon")); // NOI18N
        jbtn_agregar.setText(resourceMap.getString("jbtn_agregar.text")); // NOI18N
        jbtn_agregar.setName("jbtn_agregar"); // NOI18N
        jbtn_agregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_agregarActionPerformed(evt);
            }
        });

        jbtn_agregar1.setIcon(resourceMap.getIcon("jbtn_agregar1.icon")); // NOI18N
        jbtn_agregar1.setText(resourceMap.getString("jbtn_agregar1.text")); // NOI18N
        jbtn_agregar1.setName("jbtn_agregar1"); // NOI18N
        jbtn_agregar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_agregar1ActionPerformed(evt);
            }
        });

        jButton2.setIcon(resourceMap.getIcon("jButton2.icon")); // NOI18N
        jButton2.setText(resourceMap.getString("jButton2.text")); // NOI18N
        jButton2.setName("jButton2"); // NOI18N
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jbtn_agregar)
                .addGap(18, 18, 18)
                .addComponent(jbtn_agregar1)
                .addGap(18, 18, 18)
                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jbtn_sugerencias)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 384, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jButton1)
                .addComponent(jbtn_agregar)
                .addComponent(jbtn_agregar1)
                .addComponent(jButton2)
                .addComponent(jbtn_sugerencias))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N

        jcbx_tiendas.setToolTipText(resourceMap.getString("jcbx_tiendas.toolTipText")); // NOI18N
        jcbx_tiendas.setName("jcbx_tiendas"); // NOI18N
        jcbx_tiendas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_tiendasActionPerformed(evt);
            }
        });

        jtf_busqueda.setText(resourceMap.getString("jtf_busqueda.text")); // NOI18N
        jtf_busqueda.setToolTipText(resourceMap.getString("jtf_busqueda.toolTipText")); // NOI18N
        jtf_busqueda.setName("jtf_busqueda"); // NOI18N
        jtf_busqueda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_busquedaActionPerformed(evt);
            }
        });

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jbtn_busqueda.setIcon(resourceMap.getIcon("jbtn_busqueda.icon")); // NOI18N
        jbtn_busqueda.setText(resourceMap.getString("jbtn_busqueda.text")); // NOI18N
        jbtn_busqueda.setToolTipText(resourceMap.getString("jbtn_busqueda.toolTipText")); // NOI18N
        jbtn_busqueda.setName("jbtn_busqueda"); // NOI18N
        jbtn_busqueda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_busquedaActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_folio);
        jrbtn_folio.setText(resourceMap.getString("jrbtn_folio.text")); // NOI18N
        jrbtn_folio.setToolTipText(resourceMap.getString("jrbtn_folio.toolTipText")); // NOI18N
        jrbtn_folio.setActionCommand(resourceMap.getString("jrbtn_folio.actionCommand")); // NOI18N
        jrbtn_folio.setName("jrbtn_folio"); // NOI18N
        jrbtn_folio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_folioActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_doctoanterio);
        jrbtn_doctoanterio.setText(resourceMap.getString("jrbtn_doctoanterio.text")); // NOI18N
        jrbtn_doctoanterio.setToolTipText(resourceMap.getString("jrbtn_doctoanterio.toolTipText")); // NOI18N
        jrbtn_doctoanterio.setActionCommand(resourceMap.getString("jrbtn_doctoanterio.actionCommand")); // NOI18N
        jrbtn_doctoanterio.setName("jrbtn_doctoanterio"); // NOI18N
        jrbtn_doctoanterio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_doctoanterioActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_obserdocto);
        jrbtn_obserdocto.setText(resourceMap.getString("jrbtn_obserdocto.text")); // NOI18N
        jrbtn_obserdocto.setToolTipText(resourceMap.getString("jrbtn_obserdocto.toolTipText")); // NOI18N
        jrbtn_obserdocto.setActionCommand(resourceMap.getString("jrbtn_obserdocto.actionCommand")); // NOI18N
        jrbtn_obserdocto.setName("jrbtn_obserdocto"); // NOI18N
        jrbtn_obserdocto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_obserdoctoActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_cliente);
        jrbtn_cliente.setText(resourceMap.getString("jrbtn_cliente.text")); // NOI18N
        jrbtn_cliente.setToolTipText(resourceMap.getString("jrbtn_cliente.toolTipText")); // NOI18N
        jrbtn_cliente.setActionCommand(resourceMap.getString("jrbtn_cliente.actionCommand")); // NOI18N
        jrbtn_cliente.setName("jrbtn_cliente"); // NOI18N
        jrbtn_cliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_clienteActionPerformed(evt);
            }
        });

        jbtn_actualizar.setIcon(resourceMap.getIcon("jbtn_actualizar.icon")); // NOI18N
        jbtn_actualizar.setText(resourceMap.getString("jbtn_actualizar.text")); // NOI18N
        jbtn_actualizar.setToolTipText(resourceMap.getString("jbtn_actualizar.toolTipText")); // NOI18N
        jbtn_actualizar.setName("jbtn_actualizar"); // NOI18N
        jbtn_actualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_actualizarActionPerformed(evt);
            }
        });

        jcbx_filtrarpendientes.setText(resourceMap.getString("jcbx_filtrarpendientes.text")); // NOI18N
        jcbx_filtrarpendientes.setToolTipText(resourceMap.getString("jcbx_filtrarpendientes.toolTipText")); // NOI18N
        jcbx_filtrarpendientes.setName("jcbx_filtrarpendientes"); // NOI18N
        jcbx_filtrarpendientes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_filtrarpendientesActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_ultimos100);
        jrbtn_ultimos100.setText(resourceMap.getString("jrbtn_ultimos100.text")); // NOI18N
        jrbtn_ultimos100.setToolTipText(resourceMap.getString("jrbtn_ultimos100.toolTipText")); // NOI18N
        jrbtn_ultimos100.setActionCommand(resourceMap.getString("jrbtn_ultimos100.actionCommand")); // NOI18N
        jrbtn_ultimos100.setName("jrbtn_ultimos100"); // NOI18N
        jrbtn_ultimos100.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_ultimos100ActionPerformed(evt);
            }
        });

        jcxb_verultimos.setText(resourceMap.getString("jcxb_verultimos.text")); // NOI18N
        jcxb_verultimos.setName("jcxb_verultimos"); // NOI18N
        jcxb_verultimos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcxb_verultimosActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(122, 122, 122)
                .addComponent(jrbtn_ultimos100)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jbtn_busqueda))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jrbtn_folio, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jrbtn_doctoanterio)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_obserdocto)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_cliente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jbtn_actualizar)
                        .addGap(29, 29, 29)
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(jcbx_tiendas, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jcbx_filtrarpendientes)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jcxb_verultimos)))
                .addContainerGap(67, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2)
                        .addComponent(jbtn_busqueda)
                        .addComponent(jbtn_actualizar))
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jcbx_tiendas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel1)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jrbtn_doctoanterio, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_obserdocto, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_cliente, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_folio, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcbx_filtrarpendientes)
                    .addComponent(jrbtn_ultimos100, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcxb_verultimos))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel3.border.title"))); // NOI18N
        jPanel3.setName("jPanel3"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        jTable1.setModel(this.jtable_modelo);
        ListSelectionModel listMod =  jTable1.getSelectionModel();
        listMod.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        listMod.addListSelectionListener(jTable1);
        jTable1.setName("jtcatalogo_folios"); // NOI18N
        jTable1.getTableHeader().setReorderingAllowed(false);
        jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                if(evt.getClickCount() >= 2)
                {
                    dioclick(evt);
                    //System.out.println(" double click" );

                }
            }
        });
        jTable1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTable1KeyPressed(evt);
            }
        });
        jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTable1MouseClicked(evt);
            }
        });
        jTable1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTable1KeyPressed(evt);
            }
        });
        jScrollPane2.setViewportView(jTable1);

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jlbl_textobuscado.setFont(resourceMap.getFont("jlbl_textobuscado.font")); // NOI18N
        jlbl_textobuscado.setText(resourceMap.getString("jlbl_textobuscado.text")); // NOI18N
        jlbl_textobuscado.setName("jlbl_textobuscado"); // NOI18N

        jLabel3.setFont(resourceMap.getFont("jLabel3.font")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jlbl_cantidadregistros.setFont(resourceMap.getFont("jlbl_cantidadregistros.font")); // NOI18N
        jlbl_cantidadregistros.setText(resourceMap.getString("jlbl_cantidadregistros.text")); // NOI18N
        jlbl_cantidadregistros.setName("jlbl_cantidadregistros"); // NOI18N

        jLabel5.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 953, Short.MAX_VALUE)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jlbl_textobuscado, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addGap(18, 18, 18)
                .addComponent(jlbl_cantidadregistros, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel5)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jlbl_cantidadregistros)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(jlbl_textobuscado))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(12, Short.MAX_VALUE))
        );

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jmni_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        jmni_salir.setIcon(resourceMap.getIcon("jmni_salir.icon")); // NOI18N
        jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
        jmni_salir.setName("jmni_salir"); // NOI18N
        jmni_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_salirActionPerformed(evt);
            }
        });
        jMenu1.add(jmni_salir);

        jMenuBar1.add(jMenu1);

        jMenu3.setText(resourceMap.getString("jMenu3.text")); // NOI18N
        jMenu3.setName("jMenu3"); // NOI18N
        jMenu3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu3ActionPerformed(evt);
            }
        });

        jmni_buscar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.ALT_MASK));
        jmni_buscar.setIcon(resourceMap.getIcon("jmni_buscar.icon")); // NOI18N
        jmni_buscar.setText(resourceMap.getString("jmni_buscar.text")); // NOI18N
        jmni_buscar.setName("jmni_buscar"); // NOI18N
        jmni_buscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_buscarActionPerformed(evt);
            }
        });
        jMenu3.add(jmni_buscar);

        jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem3.setText(resourceMap.getString("jMenuItem3.text")); // NOI18N
        jMenuItem3.setName("jMenuItem3"); // NOI18N
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem3);

        jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem4.setText(resourceMap.getString("jMenuItem4.text")); // NOI18N
        jMenuItem4.setName("jMenuItem4"); // NOI18N
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem4);

        jmni_opcionbusqueda.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_MASK));
        jmni_opcionbusqueda.setText(resourceMap.getString("jmni_opcionbusqueda.text")); // NOI18N
        jmni_opcionbusqueda.setName("jmni_opcionbusqueda"); // NOI18N
        jmni_opcionbusqueda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_opcionbusquedaActionPerformed(evt);
            }
        });
        jMenu3.add(jmni_opcionbusqueda);

        jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem5.setText(resourceMap.getString("jMenuItem5.text")); // NOI18N
        jMenuItem5.setName("jMenuItem5"); // NOI18N
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem5);

        jmni_actulizar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
        jmni_actulizar.setText(resourceMap.getString("jmni_actulizar.text")); // NOI18N
        jmni_actulizar.setName("jmni_actulizar"); // NOI18N
        jmni_actulizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_actulizarActionPerformed(evt);
            }
        });
        jMenu3.add(jmni_actulizar);

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
        jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
        jMenuItem1.setName("jMenuItem1"); // NOI18N
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem1);

        jmni_agregarfolio.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.ALT_MASK));
        jmni_agregarfolio.setText(resourceMap.getString("jmni_agregarfolio.text")); // NOI18N
        jmni_agregarfolio.setName("jmni_agregarfolio"); // NOI18N
        jmni_agregarfolio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_agregarfolioActionPerformed(evt);
            }
        });
        jMenu3.add(jmni_agregarfolio);

        jMenuBar1.add(jMenu3);

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N

        jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem2.setIcon(resourceMap.getIcon("jMenuItem2.icon")); // NOI18N
        jMenuItem2.setText(resourceMap.getString("jMenuItem2.text")); // NOI18N
        jMenuItem2.setName("jMenuItem2"); // NOI18N
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem2);

        jmni_crearcomentario.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.ALT_MASK));
        jmni_crearcomentario.setText(resourceMap.getString("jmni_crearcomentario.text")); // NOI18N
        jmni_crearcomentario.setName("jmni_crearcomentario"); // NOI18N
        jmni_crearcomentario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_crearcomentarioActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_crearcomentario);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(874, Short.MAX_VALUE)
                .addComponent(jbtn_helpayuda)
                .addContainerGap())
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(5, 5, 5)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(11, 11, 11)
                .addComponent(jbtn_helpayuda))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jTable1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTable1KeyPressed
       
        //control enter se utiliza por un rollo de que al dar enter se mostraban dos veces  el documento
        control_enter+=1;
         //System.out.println(evt.getKeyCode());
        if (evt.getKeyCode() == 10)
            {
              if (control_enter > 1)
               {
                 try
                    {
                //si entra al if inicializo la variable para evitar qu al regreso entre una vez mas
                        control_enter=0;
                        int fila = jTable1.getSelectedRow();
                        Object valor = jTable1.getValueAt(fila, 0);
                    //JFrame mainFrame = Sie_invdisApp.getApplication().getMainFrame();
                    com_distri_folios_detalle fdd=new com_distri_folios_detalle(String.valueOf(valor));
                    fdd.pack();
                    fdd.setVisible(true);
                    }
                 catch (Exception ex)
                    {
                        System.out.println("ERROR no ha elegido en el cuadro de texto");
                    }
               }
            }
    }//GEN-LAST:event_jTable1KeyPressed

    private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_jTable1MouseClicked

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
       this.ayuda();
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
      if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0) {
             this.dispose();
        }
}//GEN-LAST:event_jmni_salirActionPerformed

    private void jbtn_helpayudaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_helpayudaActionPerformed
        // TODO add your handling code here:
        this.ayuda();
}//GEN-LAST:event_jbtn_helpayudaActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        //x.cierraConexion();   // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jcbx_tiendasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_tiendasActionPerformed
        // TODO add your handling code here:
          if (controlcombo > 0 )
            {
              String idcli[]=this.jcbx_tiendas.getSelectedItem().toString().split(":");

                this.jtf_busqueda.setText(idcli[2]);
                buscamp=4;
                this.buttonGroup1.setSelected(jrbtn_cliente.getModel(), true);
                this.jbtn_busquedaActionPerformed(evt);
            }


        //this.jtfpruebados.setText(jtable_tiendas.getValueAt(indeceta, 0).toString());
    }//GEN-LAST:event_jcbx_tiendasActionPerformed

    private void jrbtn_folioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_folioActionPerformed
        // TODO add your handling code here:
         buscamp=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jrbtn_folioActionPerformed

    private void jrbtn_doctoanterioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_doctoanterioActionPerformed
        // TODO add your handling code here:
         buscamp=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jrbtn_doctoanterioActionPerformed

    private void jrbtn_obserdoctoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_obserdoctoActionPerformed
        // TODO add your handling code here:
         buscamp=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jrbtn_obserdoctoActionPerformed

    private void jrbtn_clienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_clienteActionPerformed
        // TODO add your handling code here:
         buscamp=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jrbtn_clienteActionPerformed

    private void jbtn_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_busquedaActionPerformed
        // TODO add your handling code here:
         if(JOptionPane.showConfirmDialog(null, "Estan correcto sus Datos?")==0)
            {
                this.carga_datos(buscamp,this.jtf_busqueda.getText().toUpperCase());
            }
         
    }//GEN-LAST:event_jbtn_busquedaActionPerformed

    private void jtf_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_busquedaActionPerformed
        // TODO add your handling code here:
        this.jbtn_busquedaActionPerformed(evt);
    }//GEN-LAST:event_jtf_busquedaActionPerformed

    private void jmni_buscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_buscarActionPerformed
        // TODO add your handling code here:
        this.jbtn_busquedaActionPerformed(evt);
    }//GEN-LAST:event_jmni_buscarActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        // TODO add your handling code here:
        this.jtf_busqueda.requestFocus();
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        // TODO add your handling code here:
        this.jcbx_tiendas.requestFocus();
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jbtn_actualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_actualizarActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Estan correcto sus Datos?")==0)
            {
                this.carga_datos(0,"");
            }
         
    }//GEN-LAST:event_jbtn_actualizarActionPerformed

    private void jmni_opcionbusquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_opcionbusquedaActionPerformed
        // TODO add your handling code here:
        this.jrbtn_folio.requestFocus();

    }//GEN-LAST:event_jmni_opcionbusquedaActionPerformed

    private void jmni_crearcomentarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_crearcomentarioActionPerformed
        // TODO add your handling code here:
        this.crearcomentario();
    }//GEN-LAST:event_jmni_crearcomentarioActionPerformed

    private void jcbx_filtrarpendientesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_filtrarpendientesActionPerformed
        // TODO add your handling code here:
           if(JOptionPane.showConfirmDialog(null, "Deseas Ver solo Recepciones Pendientes?")==0)
            {
                this.carga_datos(5,"");
            }
    }//GEN-LAST:event_jcbx_filtrarpendientesActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        // TODO add your handling code here:
        this.jcbx_filtrarpendientesActionPerformed(evt);
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jbtn_sugerenciasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_sugerenciasActionPerformed
        // TODO add your handling code here:
        this.jmni_crearcomentarioActionPerformed(evt);
    }//GEN-LAST:event_jbtn_sugerenciasActionPerformed

    private void jmni_actulizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_actulizarActionPerformed
        // TODO add your handling code here:
        this.jbtn_actualizarActionPerformed(evt);
    }//GEN-LAST:event_jmni_actulizarActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jbtn_agregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_agregarActionPerformed
        // TODO add your handling code here:
         if(variables_global.getnivelusu()<3)
            {
                 com_distri_folios_agregar fcdfa=new com_distri_folios_agregar();
                fcdfa.pack();
                fcdfa.setVisible(true);
            }
         else
            {
               JOptionPane.showMessageDialog(null,"Opcion no disponible en su Perfil:", "Sistema Integral(Grafica cortes del dia) : Ayuda",1);
            }
       
}//GEN-LAST:event_jbtn_agregarActionPerformed

    private void jmni_agregarfolioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_agregarfolioActionPerformed
        // TODO add your handling code here:
        this.jbtn_agregarActionPerformed(evt);
    }//GEN-LAST:event_jmni_agregarfolioActionPerformed

    private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu3ActionPerformed
        // TODO add your handling code here:
      
    }//GEN-LAST:event_jMenu3ActionPerformed

    private void jrbtn_ultimos100ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_ultimos100ActionPerformed
        // TODO add your handling code here:
     buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_ultimos100ActionPerformed

    private void jcxb_verultimosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcxb_verultimosActionPerformed
        // TODO add your handling code here:
           if(JOptionPane.showConfirmDialog(null, "Deseas Ver Ultimos Folios?")==0)
            {
                this.carga_datos(6,"");
            }
    }//GEN-LAST:event_jcxb_verultimosActionPerformed

    private void jbtn_agregar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_agregar1ActionPerformed
        // TODO add your handling code here:
                com_distri_compras_altatienda fcdca=new com_distri_compras_altatienda();
                fcdca.pack();
                fcdca.setVisible(true);
    }//GEN-LAST:event_jbtn_agregar1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:

                com_distri_compras_fletes fcdcf=new com_distri_compras_fletes();
                fcdcf.pack();
                fcdcf.setVisible(true);
    }//GEN-LAST:event_jButton2ActionPerformed

private String  fechaeuropea(String fecha) {

         //resibe cadena de fecha en formato americano yyyy-MM-dd
        java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateadoresta.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaeuropa.format(fechaestaeuropa);
       return cadenafecha;

    }
     private String DiaSemana(String fe) {
         String dia = "";
       java.util.Date fecha=null;
         try
            {
             fecha = formateador.parse(fe);

           }
        catch (ParseException e)
            {
            //Error, la cadena de texto no se puede convertir en fecha.
            }
        Calendar cal= Calendar.getInstance();
        cal.setTime(fecha);
        //ojo para establecer o recetear cada parte de la fecha por separado
        //cal.set(Calendar.YEAR, fecha.getYear());
        //cal.set(Calendar.MONTH, fecha.getMonth());
        //cal.set(Calendar.DAY_OF_MONTH, fecha.getDay());
        int diaInt = cal.get(Calendar.DAY_OF_WEEK);
        switch (diaInt) {
            case 1:
                dia = "Domingo";
                break;
            case 2:
                dia = "Lunes";
                break;
            case 3:
                dia = "Martes";
                break;
            case 4:
                dia = "Miercoles";
                break;
            case 5:
                dia = "Jueves";
                break;
            case 6:
                dia = "Viernes";
                break;
            case 7:
                dia = "Sabado";
                break;

        }
        return dia;
    }

        private  void ayuda()
            {
                JOptionPane.showMessageDialog(null," 1.-Catalogo de Recepciones de Mercancia, cada una de las Opciones se autodescribe brevemente\n 2.- Cada Boton tiene Una letra Resaltada el cual indica su metodo abreviado, uselo si desea mayor rapides ( ejemplo Alt+a obtendra ayuda automaticamente)\n 3.- Para ver Detalle de un documento de Doble clik sobre el registro sombreado o use las teclas arriba o abajo luego precione enter y aparecera otra pantalla. \n ", "Sistema Integral(Detalle Recepcion) : Ayuda",1);
            }

        private void crearcomentario()
          {
                 String retorno="";

        String comentario=JOptionPane.showInputDialog("Ingresa Tu Sugerencia o Comentario:");
        if (comentario.length()>0)
        {
            rs = x.sieuno_executediversosv2("select * from x1distribucion_bitacorainserta('"+comentario+"', 'Catalogo Recepciones');",variables_global.getconexiongral());
            try
            {

               while (rs.next())
                    {
                         retorno=rs.getString(1);
                   }
             }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
            if (retorno.equals("1"))
              {
                JOptionPane.showMessageDialog(null,"Gracias Tu comentario ha sido guardado", "Sistema Integral Comentarios",1);

              }

      }
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                //com_distri_folios dialog = new com_distri_folios(new javax.swing.JFrame(), true);
                com_distri_folios dialog = new com_distri_folios();
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jTable1;
    private javax.swing.JButton jbtn_actualizar;
    private javax.swing.JButton jbtn_agregar;
    private javax.swing.JButton jbtn_agregar1;
    private javax.swing.JButton jbtn_busqueda;
    private javax.swing.JButton jbtn_helpayuda;
    private javax.swing.JButton jbtn_sugerencias;
    private javax.swing.JCheckBox jcbx_filtrarpendientes;
    private javax.swing.JComboBox jcbx_tiendas;
    private javax.swing.JCheckBox jcxb_verultimos;
    private javax.swing.JLabel jlbl_cantidadregistros;
    private javax.swing.JLabel jlbl_textobuscado;
    private javax.swing.JMenuItem jmni_actulizar;
    private javax.swing.JMenuItem jmni_agregarfolio;
    private javax.swing.JMenuItem jmni_buscar;
    private javax.swing.JMenuItem jmni_crearcomentario;
    private javax.swing.JMenuItem jmni_opcionbusqueda;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JRadioButton jrbtn_cliente;
    private javax.swing.JRadioButton jrbtn_doctoanterio;
    private javax.swing.JRadioButton jrbtn_folio;
    private javax.swing.JRadioButton jrbtn_obserdocto;
    private javax.swing.JRadioButton jrbtn_ultimos100;
    private javax.swing.JTextField jtf_busqueda;
    // End of variables declaration//GEN-END:variables

}
